<?php
/* @var $model Category */
$this->pageHeader = t('PAGE_TITLE', 'category');
$this->pageTitle = t('PAGE_TITLE', 'category');
$toolbar = new LGToolbar();
$toolbar->buttonModal('800', '450', t('PAGE_TITLE_ADDNEW', 'category'), t('BTN_ADDNEW', 'main'), app()->controller->id . '/create', array('extension' => $this->extension));
$toolbar->buttonDelete(t('BTN_DELETE'), t('BTN_DELETE'), app()->controller->id . '/delete', array('extension' => $this->extension));
$toolbar->buttonRefresh(t('BTN_REFRESH'), t('BTN_REFRESH'), url(app()->controller->id . '/refresh'));
$this->pageToolbar = $toolbar->mergeToolbar();
$this->breadcrumbs = array(t('MENU_MANAGEMENT'), t('LBL_CATEGORY', 'category') => array('index'));
?>                              
    <!-- search-form -->                                
    <div class="search-form"> 														
	<?php
$this->renderPartial('_search', array(
    'model' => $model,
));
?>
    </div>
    <input type="hidden" 
           value="<?php echo isset($_GET['extension']) ? $_GET['extension'] : LGConstant::DEFAULT_CATEGORY_EXTENSION ?>" 
           name="catExt" 
           id="catExt" />
    <!-- grid -->
    <?php
    $dataProvider = Category::getProductTypeTreeDataProvider($model, LGHelpers::getPageSize($model->count()));
    $this->widget('GridView', array(
'id' => 'DataGrid',
'dataProvider' => $dataProvider,
'itemsCssClass' => 'grid',
'summaryText' => LGHelpers::getSummary(),
'columns' => array(
    array(
	'header' => '#',
	'class' => 'CCheckBoxColumn',
	'selectableRows' => '2',
	'id' => 'chkId',
	'htmlOptions' => array('width' => '20px', 'align' => 'center'),
    ),
    array('name' => 'name',
	'value' => 'app()->controller->getMenuDisplayName($data)',
	'type' => 'raw',
	'sortable' => false,
	'htmlOptions' => array(
	)),
    array(
	'header' => t('LBL_DESCRIPTION', 'category'),
	'value' => 'CHtml::encode($data["description"])',
	'type' => 'raw',
	'htmlOptions' => array('width' => '360px'),
    ),
    array(
	'name' => 'status',
	'sortable' => false,
	'header' => t('LBL_STATUS', 'category'),
	'value' => 'Html::active($data["id"],$data["status"],"active")',
	'htmlOptions' => array('width' => '20px', 'align' => 'center'),
	'type' => 'raw',
    ),
    array(
	'name' => 'display_order',
	'sortable' => false,
	'value' => 'app()->controller->getHtmlDownButtonOfProductImage($data).app()->controller->getHtmlUpButtonOfProductImage($data)',
	'type' => 'raw',
	'htmlOptions' => array(
	    'style' => 'width:57px;text-align: center'
	)),
    array(
	'value' => 'CHtml::encode($data["updated_by"])',
	'header' => t('LBL_UPDATED_BY', 'category'),
	'htmlOptions' => array('width' => '120px', 'align' => 'center'),
	'type' => 'raw',
    ),
    array(
	'value' => '$data["update_date"]',
	'header' => t('LBL_UPDATE_DATE', 'category'),
	'htmlOptions' => array('width' => '120px', 'align' => 'center'),
	'type' => 'raw',
    ),
    array(
	'value' => '$data["id"]',
	'header' => t('LBL_ID', 'category'),
	'htmlOptions' => array('width' => '20px', 'align' => 'center'),
	'type' => 'raw',
    ),
    array(
	'header' => t('LBL_ACTION', 'category'),
	'value' => 'Html::buttonInGrid(
                    "linkEdit", 
                    url("category/update",
                    array("id"=>"$data[id]","extension"=>app()->controller->extension)),
                    "Edit", 
                    "Edit Category", 
                    "icon edit update-dialog-open-link", "800","500")',
	'htmlOptions' => array('width' => '20px', 'align' => 'center'),
	'type' => 'raw',
    ),
),
));
?>
